package com.jx.controller;

import java.io.IOException;
import java.io.PrintWriter;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.jx.model.Order;
import com.jx.service.OrderService;
import com.jx.servicrimpl.OrderServiceImpl;
/**
 * 修改一下订单表
 * @author 鄢泽然
 *
 */
public class UpdateOrderController extends HttpServlet{
	OrderService os = new OrderServiceImpl();
	@Override
	protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
		// TODO Auto-generated method stub
		doPost(req, resp);
	}
	
	@Override
	protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
		// TODO Auto-generated method stub
		req.setCharacterEncoding("utf8");
;
		int id = Integer.parseInt(req.getParameter("oid"));
		
		String time = req.getParameter("otime");	//下单时间
		String name = req.getParameter("oname");
		String pass = req.getParameter("opass");
		String address = req.getParameter("oaddress");
		String pay = req.getParameter("opay");
		int isok = Integer.parseInt(req.getParameter("oisok"));
		String finishtime = req.getParameter("ofinishtime");
		Order o =  new Order();
		o.setOid(id);
		o.setOtime(time);
		o.setOname(name);
		o.setOpass(pass);
		o.setOaddress(address);
		o.setOpay(pay);
		o.setOisok(isok);
		o.setOfinishtime(finishtime);
		int i = os.updateOrder(o);
		PrintWriter pw = resp.getWriter();
		pw.write(String.valueOf(i));
		pw.flush();
		pw.close();
			
		
	}
}
